package cn.edu.xidian.controller;

import android.app.Activity;
import android.content.Context;
import android.widget.ListView;
import cn.edu.xidian.domain.User;
import cn.edu.xidian.untils.UserListViewAdapter;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * listview组件相关操作
 */
public class ListViewController extends Activity {

    private ListView listView;//listview组件
    private UserListViewAdapter userAdapter;

    public ListViewController() {
    }

    public ListViewController(ListView listView) {
        this.listView = listView;
    }

    public ListView getListView() {
        return listView;
    }

    public void setListView(ListView listView) {
        this.listView = listView;
    }

    public UserListViewAdapter getUserAdapter() {
        return userAdapter;
    }

    public void setUserAdapter(UserListViewAdapter userAdapter) {
        this.userAdapter = userAdapter;
    }

    //显示listview
    public void showListView(Context context, ArrayList<User> users){

        userAdapter = new UserListViewAdapter(users,context);

        listView.setAdapter(userAdapter);

    }

    //更新listView
    public void updateListView(){
        userAdapter.notifyDataSetChanged();
    }



}
